package com.example.demo.common;

import org.springframework.util.StringUtils;

public class StringTools {

    public static String subLength(String val,int maxLength){
        if (!StringUtils.hasLength(val) || maxLength <= 0){
            return val;
        }
        if (val.length()<=maxLength){
            return val;
        }
        //前闭后开
        return val.substring(0,maxLength);
    }
}
